home *** CD-ROM | disk | FTP | other *** search
/ X User Tools / X User Tools (O'Reilly and Associates)(1994).ISO / sources / libxpm / libxpm34.gz / libxpm34 / xpm-3.4 / lib / XpmRdFToP.c < prev    next >
C/C++ Source or Header  |  1994-03-14  |  2KB  |  51 lines

  1. /* Copyright 1989-94 GROUPE BULL -- See license conditions in file COPYRIGHT */
  2. /*****************************************************************************\
  3. * XpmRdFToP.c:                                                                *
  4. *                                                                             *
  5. *  XPM library                                                                *
  6. *  Parse an XPM file and create the pixmap and possibly its mask              *
  7. *                                                                             *
  8. *  Developed by Arnaud Le Hors                                                *
  9. \*****************************************************************************/
  10.  
  11. #include "xpmP.h"
  12.  
  13. int
  14. XpmReadFileToPixmap(display, d, filename, pixmap_return,
  15.             shapemask_return, attributes)
  16.     Display *display;
  17.     Drawable d;
  18.     char *filename;
  19.     Pixmap *pixmap_return;
  20.     Pixmap *shapemask_return;
  21.     XpmAttributes *attributes;
  22. {
  23.     XImage *ximage, *shapeimage;
  24.     int ErrorStatus;
  25.  
  26.     /* initialize return values */
  27.     if (pixmap_return)
  28.     *pixmap_return = 0;
  29.     if (shapemask_return)
  30.     *shapemask_return = 0;
  31.  
  32.     /* create the images */
  33.     ErrorStatus = XpmReadFileToImage(display, filename, &ximage, &shapeimage,
  34.                      attributes);
  35.  
  36.     if (ErrorStatus < 0)    /* fatal error */
  37.         return (ErrorStatus);
  38.  
  39.     /* create the pixmaps and destroy images */
  40.      if (ximage) {
  41.     xpmCreatePixmapFromImage(display, d, ximage, pixmap_return);
  42.     XDestroyImage(ximage);
  43.     }
  44.     if (shapeimage) {
  45.     xpmCreatePixmapFromImage(display, d, shapeimage, shapemask_return);
  46.     XDestroyImage(shapeimage);
  47.     }
  48.  
  49.     return (ErrorStatus);
  50. }
  51.